﻿// =====================================================================
//
//  This file is part of the Microsoft Dynamics CRM SDK code samples.
//
//  Copyright (C) Microsoft Corporation.  All rights reserved.
//
//  This source code is intended only as a supplement to Microsoft
//  Development Tools and/or on-line documentation.  See these other
//  materials for detailed information regarding Microsoft code samples.
//
//  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//
// =====================================================================
#region

using System;
using SL.IdentityModel.Services;

#endregion

namespace Microsoft.Xrm.Sdk.Client
{
	public class TokenCacheManager
	{
		private static readonly TokenCache _tokenCache = new TokenCache();

		public static TokenCache TokenCache
		{
			get { return _tokenCache; }
		}

		public static String GetOrganizationServiceTokenKey(Uri serviceUri)
		{
			ClientExceptionHelper.ThrowIfNull(serviceUri, "serviceUri");
			UriBuilder builder = new UriBuilder(serviceUri);
			builder.Query = String.Empty;
			builder.Path = String.Empty;
			return builder.Uri.AbsoluteUri;
		}
	}
}
